OPC Studio User's Guide and Reference
Referencing the Components (COM)
Client and Subscriber Development > Development Fundamentals > Referencing the Components (COM)

Your application first needs to reference the OPC Data Client-COM or OPC Data Client-UA for COM components in order to use the functionality contained in them. How this is done depends on the language and tool you are using.

In Visual Basic 6.0 and Visual Basic for Applications (e.g. Microsoft Excel, Word, Access, PowerPoint, and many non-Microsoft tools),  select Project -> References (or Tools  -> References) from the menu. You are then presented with a References dialog. The OPC Data Client-COM type libraries should be listed in alphabetical order, prefixed with “OPC Labs” in their name so that you can easily find them grouped together:

Check the boxes next to the libraries you are referencing, and press OK.

Some tools provide a different user interface for referencing the components, while yet others do not have any user interface at all, and you need to write a source code statement that references the type library directly.

If the library you are looking for is not listed, it may be necessary to specify its location explicitly. Sometimes, simply restarting the Visual Basic 6.0 helps. Otherwise, press the Browse… button (or a corresponding UI element in other tools), and navigate to the SDK\lib subdirectory of the OPC Data Client product installation folder on your disk. Then, select the type library file you are looking for (e.g. OpcLabs.BaseLib.tlb for “OPC Labs Base Library Core”).

Note that referencing the type library in WSH (Windows Script Host) or ASP is only needed if you want to use certain features, such as the named constants included in the library. It is not necessary to reference the type library for simply instantiating the components and making methods calls, as for method calls, VBScript or JScript code in WSH or ASP can interrogate the created objects and use late binding to perform the calls.

It is also possible to do away with referencing the component in Visual Basic 6.0 and Visual Basic for Applications, and proceed simply to instantiating the object(s) as described further below, in a way similar to VBScript, but you would lose several features such as the early-binding, IntelliSense, and ability to use symbolic objects names and enumeration constants from the type library.

 

The features discussed here, or some of them, may not be available in all editions of the product. Check the Product Editions page for differences between the editions. The trial license has all features enabled (and is limited in period for which it provides valid data), but licenses for specific commercial editions may have functionality limitations.

 

See Also